//
//  LNHConfirmOrderCell.m
//  LNH
//
//  Created by cruise on 2018/2/14.
//  Copyright © 2018年 twentylx. All rights reserved.
//

#import "LNHConfirmOrderCell.h"

@interface LNHConfirmOrderCell()

@property (nonatomic, strong) UIView *coverView;

@end

@implementation LNHConfirmOrderCell

-(instancetype) initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        [self.contentView addSubview:self.goodsImageView];
        [self.contentView addSubview:self.coverView];
        [self.coverView addSubview:self.nameLabel];
        [self.coverView addSubview:self.priceLabel];
        [self.coverView addSubview:self.numLabel];
        
        [self.goodsImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.size.mas_equalTo(CGSizeMake(80, 80));
            make.top.equalTo(self.contentView).offset(15);
            make.left.equalTo(self.contentView).offset(15);
            make.bottom.equalTo(self.contentView.mas_bottom);
        }];
        
        [self.coverView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.contentView).offset(20);
            make.left.equalTo(self.goodsImageView.mas_right).offset(5);
            make.right.equalTo(self.contentView);
            make.bottom.equalTo(self.contentView.mas_bottom).offset(-5);
        }];
        
        [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.coverView).offset(15);
            make.left.equalTo(self.coverView).offset(15);
            make.right.equalTo(self.coverView).offset(-15);
            make.height.mas_equalTo(20);
        }];
        
        [self.priceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.equalTo(self.coverView).offset(-15);
            make.left.equalTo(self.coverView).offset(15);
            make.height.mas_equalTo(20);
            make.width.mas_equalTo(80);
        }];
        
        [self.numLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.equalTo(self.coverView).offset(-15);
            make.right.equalTo(self.coverView).offset(-15);
            make.height.mas_equalTo(20);
            make.width.mas_equalTo(80);
        }];
    }
    return self;
}

-(UIImageView *) goodsImageView {
    if (!_goodsImageView) {
        _goodsImageView = [UIImageView new];
//        [_goodsImageView.layer setBorderWidth:1];
    }
    return _goodsImageView;
}

-(UIView *) coverView {
    if (!_coverView) {
        _coverView = [UIView new];
        [_coverView setBackgroundColor:RGBCOLOR(250, 250, 250)];
    }
    return _coverView;
}

-(UILabel *) nameLabel {
    if (!_nameLabel) {
        _nameLabel = [UILabel new];
        [_nameLabel setText:@"已选：swarovski施华洛世奇"];
        [_nameLabel setFont:[UIFont systemFontOfSize:12]];
        [_nameLabel setTextColor:RGBCOLOR(35,24,21)];
    }
    return _nameLabel;
}

-(UILabel *) priceLabel {
    if (!_priceLabel) {
        _priceLabel = [UILabel new];
        [_priceLabel setText:@"￥：380.00"];
        [_priceLabel setFont:[UIFont systemFontOfSize:12]];
        [_priceLabel setTextColor:RGBCOLOR(233,85,19)];
    }
    return _priceLabel;
}

-(UILabel *) numLabel {
    if (!_numLabel) {
        _numLabel = [UILabel new];
        [_numLabel setText:@"X1"];
        [_numLabel setFont:[UIFont systemFontOfSize:12]];
        [_numLabel setTextColor:RGBCOLOR(35,24,21)];
        [_numLabel setTextAlignment:NSTextAlignmentRight];
    }
    return _numLabel;
}

@end
